﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iTunesLib;
using System.Text.RegularExpressions;

namespace iTunesFastForward.Lyrics
{
    public class LyricsDesignation
    {
        public string Artist { get; set; }
        public string Song { get; set; }
        public string Album { get; set; }

        private string _lyrics;
        public string Lyrics { 
            get { return _lyrics; }
            set
            {
                if (value == null)
                {
                    _lyrics = value;
                    return;
                }
                // formater le contenu
                // supprimer les tags 
                value = Utils.ClearHTMLTags(value);

                //value = value.Replace("<br>", string.Empty)
                //    .Replace("<BR>", string.Empty)
                //    .Replace("<br />", string.Empty)
                //    .Replace("<BR />", string.Empty)
                //    .Replace("<br/>", string.Empty)
                //    .Replace("<BR/>", string.Empty);

                // faire des lignes
                string[] lines = value.Split('\n');

                // trim sur chaque ligne
                foreach (var l in lines)
                    l.Trim();

                _lyrics = string.Join("\n", lines);
            }
        }

        public LyricsProvider Provider { get; set; }

        public static LyricsDesignation FromIITTrack(IITTrack t)
        {
            return new LyricsDesignation { Artist = t.Artist, Song = t.Name };
        }

        
    }
}
